type Diff<O extends Record<string, any>, O1 extends Record<string, any>> = {
  [P in keyof O | keyof O1 as P extends keyof O
    ? P extends keyof O1
      ? never
      : P
    : P]: P extends keyof O ? O[P] : P extends keyof O1 ? O1[P] : never;
};

type Foo = {
  name: string;
  age: string;
};

type Coo = {
  name: string;
  gender: number;
};

type cases = Diff<Foo, Coo>; //  { age: string; gender: number }
